package cn.mesmile.activity.config;

import cn.mesmile.activity.config.multi.WfParallelMultiInstanceActivityBehavior;
import cn.mesmile.activity.config.multi.WfSequentialMultiInstanceActivityBehavior;
import org.activiti.bpmn.model.Activity;
import org.activiti.bpmn.model.UserTask;
import org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
import org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
import org.activiti.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
import org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory;

/**
 * @author zb
 * @date 2022/1/5 15:05
 * @Description 自定义的BehaviorFactory
 */
public class WfActivityBehaviorFactory extends DefaultActivityBehaviorFactory {

	@Override
	public UserTaskActivityBehavior createUserTaskActivityBehavior(UserTask userTask) {
		return new WfUserTaskActivityBehavior(userTask);
	}

	@Override
	public ParallelMultiInstanceBehavior createParallelMultiInstanceBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) {
		// 自定义拦截并行多实例
		return new WfParallelMultiInstanceActivityBehavior(activity, innerActivityBehavior);
	}

	@Override
	public SequentialMultiInstanceBehavior createSequentialMultiInstanceBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) {
		// 自定义拦截串行多实例
		return new WfSequentialMultiInstanceActivityBehavior(activity, innerActivityBehavior);
	}


}